import request from './request'
import qs from 'qs'
export const getVerifyApi = phone=>request.post('/sendSMS',`phone=${phone}`)
// export const phoneLoginApi = data =>request.post('/phoneRegin',`verifyCode=${data.code}&&phone=${data.phone}`)
export const phoneLoginApi = data =>request.post('/phoneRegin',qs.stringify({verifyCode:data.code,phone:data.phone}))
// getUserInfoApi 用于获取用户登录成功后 使用token获取用户信息
export const getUserInfoApi = ()=>request.get('/shop/userProfiles')
export const WXLoginApi = code => request.post(`/wechatUsers/PCLogin`,qs.stringify({code}));
// export const WeixinLoginApi = (params) => request.post(`/wechatUsers/PCLogin`, qs.stringify(params));

// 获取精品推荐的数据 
export const getRecommendApi =  ()=>request.get('/products/recommend')
export const getHotListApi =  ()=>request.get('/products/hot')
export const getGoodsListApi = params=>request.get('/products',{params})
export const getGoodsDetailApi = params=>request.get(`/products/${params}`)
export const addToCarApi = params=>request.post(`/shop/carts/add`,qs.stringify(params))
export const getCartDataApi = ()=>request.get('/shop/carts')
export const getDeleteCartApi = id=>request.delete(`/shop/carts?productIds=${id}`)